<template>
    <div class="tab-bar-item" @click="itemClick">
        <!-- <img src="../../assets/img/tabbar/首页.png" alt=""> -->
        <!-- <div>首页</div> -->
        <div v-if="!isActive"> <slot name="item-icon"></slot> </div>
        <div v-else> <slot name="item-icon-active"></slot> </div>
        <div :class="{active:isActive}"> <slot name="item-text"></slot> </div>
    </div>
</template>
<script>
export default {
    name:'tabbaritem',
    props:{
        path:{
            type:String
        }
    },
    data(){
        return {
            // isActive:true,

        }
    },
    computed:{
        isActive(){
            return !this.$route.path.indexOf(this.path)
        }
    },
    methods:{
        // 路由跳转
        itemClick(){
            this.$router.push(this.path)
        }
    }
}
</script>
<style>
.tab-bar-item {
    /* position: relative;
    bottom: -5px; */
  display: block;
  flex: 1;
  text-align: center;
  height: 49px;
  font-size: 14px;
}
.tab-bar-item img {
    align-items: center;
    width: 24px;
    height: 24px;
    margin-top: 3px;
    vertical-align: middle;
}
.active{
    color:rgb(252, 199, 250);
}
</style>